<?php
namespace App\Console\Commands;

use App\Models\User;
use App\Services\OpenImService;
use Illuminate\Console\Command;

class InitImUser extends Command
{
    protected $signature = 'init_im:user';

    protected $description = '初始化同步im用户';

    public function handle()
    {
        $users = User::get() -> toArray();

        $res = OpenImService::initUser($users);

        if($res['errCode'] != 0) {
            echo $res['errMsg'];
        } else {
            echo "已成功同步";
        }
    }

}
